package com.JinYuan.controller;

import com.JinYuan.pojo.User;


import com.JinYuan.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.math.MathContext;
import java.util.List;

/**
 * @author 金园
 * @create 2022/5/11
 * @Description
 * @className UserController
 * @packageName com.JinYuan.controller
 */
@Controller
public class UserController {
    
    UserService userService;
    @Autowired
    public void setUserService(UserService userService) {
        this.userService = userService;
    }

    @GetMapping("/users")
    public String findAll(ModelMap map,
                          @RequestParam(value = "pageNum",required = false,defaultValue = "1")Integer pageNum,
                          @RequestParam(value = "pageSize",required = false,defaultValue = "2")Integer pageSize){
//        List<User> users = userService.findAll();
        List<User> users = userService.Page(pageNum,pageSize);
        return "foreword/userAll.jsp";
    }
}
